<?php
/**
* The Header for our index file.
*
* @package fructa
* @since fructa 1.0
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo('charset'); ?>">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=800; user-scalable=no;" />
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	<meta name="author" content="Fructa www.fructacr.com" />
	<title><?php bloginfo('name'); ?><?php wp_title(':'); ?></title>
	<meta name="description" content="<?php bloginfo('description'); ?>" />
	
	<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/bgsl.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_uri(); ?>" />
	<link rel="stylesheet" type="text/css" media='screen (max-width: 800px)' href="<?php echo get_template_directory_uri(); ?>/css/style-responsive.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/index.css" />
	<!--[if lt IE 9]>
      <style>
      	.f-showPhone{
      		display:none!important;
      	}
     </style>
     <![endif]-->
     <!--[if lte IE 8]>
	<style>
      	.f-menu ul li div.f-menuItem {
      	background: url("/wp-content/themes/fructa/images/green-bg-menu.png") 0 0 repeat-x;
      	}
      	.f-menu ul li.orange div.f-menuItem {
  		background: url("/wp-content/themes/fructa/images/orange-bg.png") 0 0 repeat-x;
  		}
     </style>
	<![endif]-->
</head>
<body>
	<!-- ***************Begins Slider*************** -->
	<div class="f-bgSlider">
		<ul class="bgsl">
			<?php
			$args = array('post_type' => 'attachment', 'post_status' => 'inherit', 'category_name' => 'Slider');
			$the_query = new WP_Query($args);
			if ($the_query->have_posts()) {
				while ($the_query->have_posts()) {
					$the_query->the_post();
					echo '<li>';
					echo wp_get_attachment_image($attachment->ID, 'full');
					echo '</li>';
				}
			}
			wp_reset_postdata();
			?>
		</ul><!-- end of bgsl -->
	</div><!-- end of f-bgSlider --> 
	<!-- ***************Ends Slider*************** -->

	<!-- ***************Begins Wrapper*************** -->
	<div class="f-index f-wrapper">
		<div class="f-header container f-hidePhone">
			<div class="logo">
				<h1><img alt="Fructa CR" src="<?php bloginfo('template_url'); ?>/images/fructa-logo.png" ></h1>
			</div><!-- end of logo -->
			<?php
				$the_query = new WP_Query('pagename=home');
				if ($the_query->have_posts()) {
					while ($the_query->have_posts()) {
						$the_query->the_post();
						the_content();
					}
				}
				wp_reset_postdata();
			?>
		</div><!--end of header-->

		<div class="f-header-phone row-fluid f-showPhone" >
			<div class="logo span5">
				<h1><img alt="Fructa CR" src="<?php bloginfo('template_url'); ?>/images/fructa-logo2.png" ></h1>
			</div><!-- end logo span5 -->
		</div><!--end header phone-->

		<div class="f-menu container">
			<ul class="row-fluid">
				<?php
				$the_query = new WP_Query(array ('category_name'=>'Pages Menu','orderby' => 'menu_order','order' => 'ASC'));
				if ($the_query->have_posts()) {
					$counterMenu = 0; 
					while ($the_query->have_posts()) {
						$the_query->the_post();
						$counterMenu++;
				?>
						<li class="span2 <?php if($counterMenu==2||$counterMenu==4){echo 'orange';}?>">
							<div class="f-menuItem f-withText">
								<div class="f-titleContainer">
									<div class="f-image">
										<?php
											if (has_post_thumbnail()) {										
												the_post_thumbnail(array('src'	=> $src, 'class' => " f-img ", 'alt' => trim(strip_tags($wp_postmeta->_wp_attachment_image_alt)),));
											} 
										?>
									</div><!-- f-image -->
									<a href="<?php the_permalink(); ?>" class="f-title" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
								</div><!-- f-titleContainer -->
								<div class="f-subText">
									<?php the_excerpt();?>
								</div>				
							</div>
						</li>
				<?php
														}
												}
				wp_reset_postdata();
				?>
			</ul>
		</div><!-- f-menu -->	

		<div class="f-footer">
			<div class="f-inner">
				<?php
				$the_query = new WP_Query('name=footer');
				if ($the_query->have_posts()) {
					while ($the_query->have_posts()) {
						$the_query->the_post();
						the_content();
					}
				}
				wp_reset_postdata();
				?>
				<ul class="f-language">
				<?php
				global $q_config;
				foreach(qtrans_getSortedLanguages() as $language) {
				?>
				<li>
					<a href="<?php echo qtrans_convertURL($url, $language);?>" title="<?php echo $q_config['language_name'][$language]; ?>">
						<img src="<?php bloginfo('template_url'); ?>/images/<?php echo $q_config['locale'][$language]; ?>_flag.jpg" alt="See this page on <?php echo $q_config['language_name'][$language]; ?>"/>
					</a>
				</li>
					
				<?php
				}
				?>
				</ul>
			</div><!-- end of f-inner -->
		</div><!--end of footer-->
	</div><!--  end of f-index f-wrapper -->
	<!-- ***************Ends Wrapper*************** -->

	<script src="<?php echo get_template_directory_uri(); ?>/js/jquery-1.10.2.min.js" type="text/javascript"></script>
	<script src="<?php echo get_template_directory_uri(); ?>/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="<?php echo get_template_directory_uri(); ?>/js/detectmobilebrowser.js" type="text/javascript"></script>
	<script src="<?php echo get_template_directory_uri(); ?>/js/bg-slider.js" type="text/javascript"></script>
	<script src="<?php echo get_template_directory_uri(); ?>/js/main.js" type="text/javascript"></script>

	<script type="text/javascript">
	$(document).ready(function(){
		$('.f-bgSlider').bgsl();
		if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
			
		}else{
			addMenuHover();
		}
		
		if ($.browser.msie  && parseInt($.browser.version, 10) === 8) {
 			
		} 

	});
	</script>
	<?php get_template_part('googleanalytics'); ?>
</body>
</html>